#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, M=0;
    cin >> n;
    int a[n];
    for (int i=0;i<n;++i) { // O(n)
    	cin >> a[i];
    	M = max(M, a[i]);
	}
	
	vector<int> buckets[10];
	int base = 1;
	while (M>0) {
		for (int i=0;i<n;++i) { // o(n)
			int b = a[i]/base%10;
			buckets[b].push_back(a[i]);
		}
		
		for(int i=0, j=0;i<10;++i) { // o(n)
			int size = buckets[i].size();
			for(int b=0;b<size;++b) {
				a[j] = buckets[i][b];
				++j;
			}
			buckets[i].erase(buckets[i].begin(), buckets[i].end());
		}
		
		M /= 10;
		base *= 10;
	}
	
	for (int i=0;i<n;++i) {
		cout << a[i] << " ";
	}
	
	return 0;
}

